package main

import (
	"fmt"
)

func main() {
	// map
	println("map的声明和使用：")
	m1 := make(map[string]string)
	m1["China"] = "Beijing"
	m1["Japan"] = "Tokio"
	m1["America"] = "Wasonton"
	fmt.Printf("m1: %v \n", m1)
	capitalInfo := FindCapital(m1, "Koria")
	println(capitalInfo)
}

func FindCapital(countryMap map[string]string, country string) string {
	capital, ok := countryMap[country]
	if ok {
		capital = fmt.Sprintf("%s的首都是：%s", country, capital)
	} else {
		capital = fmt.Sprintf("%s的首都我不知道", country)
	}
	return capital
}
